package com.ykdl.member.kid.adapters;

import java.util.ArrayList;

import com.ykdl.member.kid.R;
import com.ykdl.member.kid.adapters.FansAdapter.ViewHolder;
import com.ykdl.member.kid.beans.StoreBean;
import com.ykdl.member.kid.beans.StoreInfoJsonBean;
import com.ykdl.member.kid.beans.SystemMessageBean;
import com.ykdl.member.kid.widget.AsyncImageView;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class CardAdapter  extends BaseAdapter{
	private Activity mContext ;
	private ArrayList<StoreInfoJsonBean> list;
	public CardAdapter(Activity context){
		mContext = context;
	}
	public void setlist(ArrayList<StoreInfoJsonBean>  list) {
		this.list = list ;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		if (list != null) {
			return list.size();
		} else {
			return 0;
		}
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		if (getCount() != 0) {
			return list.get(position-1);
		} else {
			return null;
		}
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder holder = null;
		if (convertView == null) {
			convertView = RelativeLayout.inflate(mContext, R.layout.dialog_item, null);
			holder = new ViewHolder();
			holder.card_name = (TextView) convertView.findViewById(R.id.card_name);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.card_name.setText(list.get(position).getName());
		
		return convertView;
	}
	class ViewHolder {
		TextView card_name;
	}
}
